import 'package:flutter/material.dart';

import '../../components/myIcon.dart';

/// 自定义字体图标
/// 
/// 自定义字体图标需要在 pubspec.yaml 内添加字体文件
/// fonts:
///   - family: MyIcon
///     fonts:
///       - asset: assets/fonts/MyIcon.ttf
/// 
/// 具体使用参考 components/myIcon.dart
/// 
/// 系统图标 参考 https://api.flutter.dev/flutter/material/Icons-class.html
class IconDome extends StatelessWidget {
  const IconDome({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Icon'),
      ),
      body: Column(
        children: [
          SizedBox(height: 20,child: const Text('系统图标'),),
          Icon1(),
          SizedBox(height: 20,child: const Text('自定义字体图标'),),
          Icon2(),
        ],
      ),
    );    
  }
}

class Icon1 extends StatelessWidget {
  const Icon1({super.key});

  @override
  Widget build(BuildContext context) {
    return Row(
        children: [
          Icon(
            Icons.home,
            size: 60,
            color: Colors.blue,
          ),
          SizedBox(width: 10,),
          Icon(
            Icons.settings,
            size: 20,
            color: Colors.red,
          ),
          SizedBox(width: 10,),
          Icon(Icons.search),
          SizedBox(width: 10,),
          Icon(Icons.person),
          SizedBox(width: 10,),
          Icon(Icons.category),
        ],
    );
  }
}

class Icon2 extends StatelessWidget {
  const Icon2({super.key});

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Icon(MyIcon.baocunshaixuan),
        SizedBox(width: 10,),
        Icon(MyIcon.bizhong2),
        SizedBox(width: 10,),
        Icon(MyIcon.gengduoshaixuan),
        SizedBox(width: 10,),
        Icon(MyIcon.shoucang),
        SizedBox(width: 10,),
      ],
    );
  }
}
